package cn.yunyichina.provider.order.service;

import cn.yunyichina.provider.framework.dubbo.service.impl.YytServiceImpl;
import cn.yunyichina.provider.iface.entity.common.ResCommon;
import cn.yunyichina.provider.iface.entity.order.OrderRegSchedulerVo;
import cn.yunyichina.provider.iface.entity.order.facepay.FacepayResponseVO;
import cn.yunyichina.provider.iface.service.IOrder;
import cn.yunyichina.provider.order.service.impl.FacepayServiceImpl;
import cn.yunyichina.provider.order.service.impl.OrderRegSchedulerServiceImpl;
import cn.yunyichina.utils.commons.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

/**
 * Created by Lullaby on 2017/1/12.
 */
public class OrderServiceImpl extends YytServiceImpl implements IOrder {

    @Autowired
    private FacepayServiceImpl facepayService;

    @Autowired
    private OrderRegSchedulerServiceImpl orderRegSchedulerService;

    public String getErrorCode() {
        return "12000";
    }

    public ResCommon<FacepayResponseVO> openapiFacepay(String params) {
        return facepayService.openapiFacepay(params);
    }

    /**
     * 挂号停诊。解锁订单保存到中间表
     */
    public void addOrderRegScheduler(OrderRegSchedulerVo vo) {
        orderRegSchedulerService.addOrderRegScheduler(vo);
    }

    public OrderRegSchedulerVo selectOrderRegSchedulerById(String id) {
        return orderRegSchedulerService.selectOrderRegSchedulerById(id);
    }

    public void updateOrderRegScheduler(OrderRegSchedulerVo vo) {
        vo.setUpdateTime(DateUtils.dateToString(new Date()));
        orderRegSchedulerService.updateOrderRegScheduler(vo);
    }

    public List<OrderRegSchedulerVo> findOrderRegScheduler(OrderRegSchedulerVo vo) {
        return orderRegSchedulerService.findOrderRegScheduler(vo);
    }

}
